import pandas as pd
import copy

def nptolist(npdata):
    l1 = []
    n = 0
    for i in npdata:
        l2 = []
        for j in i:
            if isinstance(j, str):
                l2.append(j)
        l1.append(l2)
        n += 1
    print("***********")
    return l1

def tracetostream(data):
    list=[]
    for i in range(len(data)):
        for j in data[i]:
            l = []
            l.append('case'+str(i))
            l.append(j)
            list.append(l)
    return list


if __name__ == '__main__':
    deldata = pd.read_csv('deldata.csv',low_memory=False, index_col=0)
    deldata=deldata.values
    print(len(deldata))
    deldata=nptolist(deldata)
    print(len(deldata))
    deldata=tracetostream(deldata)
    deldata=pd.DataFrame(deldata)
    deldata.columns=['caseid','event']
    deldata.to_csv('delstream.csv',index=False)